#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<malloc.h>
#include<string.h>

int* masterMind(char* solution, char* guess, int* returnSize) 
{
	int realguess = 0, virguess = 0;
	int i = 0, j = 0;
	for (i = 0; i < 4; i++)
	{
		if (solution[i] == guess[i])
		{
			solution[i] = '0';
			guess[i] = '1';
			realguess++;
		}
	}
	/*for (i = 0; i < 4; i++)
	{
		for (j = 0; j < 4; j++)
		{
			if (guess[i] == solution[j])
			{
				virguess++;
				solution[j] = '0';
				break;
			}
		}
	}*/
	i = 0;
	do {
		do {
			if (guess[i] == solution[j]) {
				virguess++;
				solution[j] = '0';
				break;
			}
			j++;
		} while (j < 4);
		j = 0;
		i++;
	} while (i < 4);


	int* ret= malloc(2 * sizeof(int));
	ret[0] = realguess;
	ret[1] = virguess;
	*returnSize = 2;
	return ret;
}

int main()
{
	char arrS[4] = "BRBB";
	char arrG[4] = "RBGY";
	int  arr [2]={0,1};
	int returnSize = 0;
	strcpy(arr, masterMind(arrS, arrG, &returnSize));
	//&arr = masterMind(arrS, arrG, &returnSize);

	printf("%d %d\n", arr[0], arr[1]);
	return 0;
}